home *** CD-ROM | disk | FTP | other *** search
/ Windows Game Programming for Dummies (2nd Edition) / WinGamProgFD.iso / mac / DirectX SDK / DXSDK / include / d3dx8effect.h < prev    next >
C/C++ Source or Header  |  2001-10-08  |  7KB  |  227 lines

  1. ///////////////////////////////////////////////////////////////////////////
  2. //
  3. //  Copyright (C) Microsoft Corporation.  All Rights Reserved.
  4. //
  5. //  File:       d3dx8effect.h
  6. //  Content:    D3DX effect types and functions
  7. //
  8. ///////////////////////////////////////////////////////////////////////////
  9.  
  10. #include "d3dx8.h"
  11.  
  12. #ifndef __D3DX8EFFECT_H__
  13. #define __D3DX8EFFECT_H__
  14.  
  15.  
  16. #define D3DXFX_DONOTSAVESTATE  (1 << 0)
  17.  
  18.  
  19. typedef enum _D3DXPARAMETERTYPE
  20. {
  21.     D3DXPT_DWORD        = 0,
  22.     D3DXPT_FLOAT        = 1,
  23.     D3DXPT_VECTOR       = 2,
  24.     D3DXPT_MATRIX       = 3,
  25.     D3DXPT_TEXTURE      = 4,
  26.     D3DXPT_VERTEXSHADER = 5,
  27.     D3DXPT_PIXELSHADER  = 6,
  28.     D3DXPT_CONSTANT     = 7,
  29.     D3DXPT_STRING       = 8,
  30.     D3DXPT_FORCE_DWORD  = 0x7fffffff /* force 32-bit size enum */
  31.  
  32. } D3DXPARAMETERTYPE;
  33.  
  34.  
  35. typedef struct _D3DXEFFECT_DESC
  36. {
  37.     UINT Parameters;
  38.     UINT Techniques;
  39.  
  40. } D3DXEFFECT_DESC;
  41.  
  42.  
  43. typedef struct _D3DXPARAMETER_DESC
  44. {
  45.     LPCSTR Name;
  46.     LPCSTR Index;
  47.     D3DXPARAMETERTYPE Type;
  48.  
  49. } D3DXPARAMETER_DESC;
  50.  
  51.  
  52. typedef struct _D3DXTECHNIQUE_DESC
  53. {
  54.     LPCSTR Name;
  55.     LPCSTR Index;
  56.     UINT   Passes;
  57.  
  58. } D3DXTECHNIQUE_DESC;
  59.  
  60.  
  61. typedef struct _D3DXPASS_DESC
  62. {
  63.     LPCSTR Name;
  64.     LPCSTR Index;
  65.  
  66. } D3DXPASS_DESC;
  67.  
  68.  
  69.  
  70. //////////////////////////////////////////////////////////////////////////////
  71. // ID3DXEffect ///////////////////////////////////////////////////////////////
  72. //////////////////////////////////////////////////////////////////////////////
  73.  
  74. typedef interface ID3DXEffect ID3DXEffect;
  75. typedef interface ID3DXEffect *LPD3DXEFFECT;
  76.  
  77. // {648B1CEB-8D4E-4d66-B6FA-E44969E82E89}
  78. DEFINE_GUID( IID_ID3DXEffect, 
  79. 0x648b1ceb, 0x8d4e, 0x4d66, 0xb6, 0xfa, 0xe4, 0x49, 0x69, 0xe8, 0x2e, 0x89);
  80.  
  81.  
  82. #undef INTERFACE
  83. #define INTERFACE ID3DXEffect
  84.  
  85. DECLARE_INTERFACE_(ID3DXEffect, IUnknown)
  86. {
  87.     // IUnknown
  88.     STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE;
  89.     STDMETHOD_(ULONG, AddRef)(THIS) PURE;
  90.     STDMETHOD_(ULONG, Release)(THIS) PURE;
  91.  
  92.     // ID3DXEffect
  93.     STDMETHOD(GetDevice)(THIS_ LPDIRECT3DDEVICE8* ppDevice) PURE;
  94.     STDMETHOD(GetDesc)(THIS_ D3DXEFFECT_DESC* pDesc) PURE;
  95.     STDMETHOD(GetParameterDesc)(THIS_ LPCSTR pParameter, D3DXPARAMETER_DESC* pDesc) PURE;
  96.     STDMETHOD(GetTechniqueDesc)(THIS_ LPCSTR pTechnique, D3DXTECHNIQUE_DESC* pDesc) PURE;
  97.     STDMETHOD(GetPassDesc)(THIS_ LPCSTR pTechnique, LPCSTR pPass, D3DXPASS_DESC* pDesc) PURE;
  98.     STDMETHOD(FindNextValidTechnique)(THIS_ LPCSTR pTechnique, D3DXTECHNIQUE_DESC* pDesc) PURE;
  99.     STDMETHOD(CloneEffect)(THIS_ LPDIRECT3DDEVICE8 pDevice, LPD3DXEFFECT* ppEffect) PURE;
  100.     STDMETHOD(GetCompiledEffect)(THIS_ LPD3DXBUFFER* ppCompiledEffect) PURE;
  101.  
  102.     STDMETHOD(SetTechnique)(THIS_ LPCSTR pTechnique) PURE;
  103.     STDMETHOD(GetTechnique)(THIS_ LPCSTR* ppTechnique) PURE;
  104.  
  105.     STDMETHOD(SetDword)(THIS_ LPCSTR pParameter, DWORD dw) PURE;
  106.     STDMETHOD(GetDword)(THIS_ LPCSTR pParameter, DWORD* pdw) PURE; 
  107.     STDMETHOD(SetFloat)(THIS_ LPCSTR pParameter, FLOAT f) PURE;
  108.     STDMETHOD(GetFloat)(THIS_ LPCSTR pParameter, FLOAT* pf) PURE;    
  109.     STDMETHOD(SetVector)(THIS_ LPCSTR pParameter, CONST D3DXVECTOR4* pVector) PURE;
  110.     STDMETHOD(GetVector)(THIS_ LPCSTR pParameter, D3DXVECTOR4* pVector) PURE;
  111.     STDMETHOD(SetMatrix)(THIS_ LPCSTR pParameter, CONST D3DXMATRIX* pMatrix) PURE;
  112.     STDMETHOD(GetMatrix)(THIS_ LPCSTR pParameter, D3DXMATRIX* pMatrix) PURE;
  113.     STDMETHOD(SetTexture)(THIS_ LPCSTR pParameter, LPDIRECT3DBASETEXTURE8 pTexture) PURE;
  114.     STDMETHOD(GetTexture)(THIS_ LPCSTR pParameter, LPDIRECT3DBASETEXTURE8 *ppTexture) PURE;
  115.     STDMETHOD(SetVertexShader)(THIS_ LPCSTR pParameter, DWORD Handle) PURE;
  116.     STDMETHOD(GetVertexShader)(THIS_ LPCSTR pParameter, DWORD* pHandle) PURE;
  117.     STDMETHOD(SetPixelShader)(THIS_ LPCSTR pParameter, DWORD Handle) PURE;
  118.     STDMETHOD(GetPixelShader)(THIS_ LPCSTR pParameter, DWORD* pHandle) PURE;
  119.     STDMETHOD(SetString)(THIS_ LPCSTR pParameter, LPCSTR pString) PURE;
  120.     STDMETHOD(GetString)(THIS_ LPCSTR pParameter, LPCSTR* ppString) PURE;
  121.     STDMETHOD_(BOOL, IsParameterUsed)(THIS_ LPCSTR pParameter) PURE;
  122.  
  123.     STDMETHOD(Validate)(THIS) PURE;
  124.     STDMETHOD(Begin)(THIS_ UINT *pPasses, DWORD Flags) PURE;
  125.     STDMETHOD(Pass)(THIS_ UINT Pass) PURE;
  126.     STDMETHOD(End)(THIS) PURE;
  127.     STDMETHOD(OnLostDevice)(THIS) PURE;
  128.     STDMETHOD(OnResetDevice)(THIS) PURE;
  129. };
  130.  
  131.  
  132.  
  133. //////////////////////////////////////////////////////////////////////////////
  134. // APIs //////////////////////////////////////////////////////////////////////
  135. //////////////////////////////////////////////////////////////////////////////
  136.  
  137.  
  138. #ifdef __cplusplus
  139. extern "C" {
  140. #endif //__cplusplus
  141.  
  142.  
  143. //----------------------------------------------------------------------------
  144. // D3DXCreateEffect:
  145. // -----------------
  146. // Creates an effect from an ascii or binaray effect description.
  147. //
  148. // Parameters:
  149. //  pDevice
  150. //      Pointer of the device on which to create the effect
  151. //  pSrcFile
  152. //      Name of the file containing the effect description
  153. //  hSrcModule
  154. //      Module handle. if NULL, current module will be used.
  155. //  pSrcResource
  156. //      Resource name in module
  157. //  pSrcData
  158. //      Pointer to effect description
  159. //  SrcDataSize
  160. //      Size of the effect description in bytes
  161. //  ppEffect
  162. //      Returns a buffer containing created effect.
  163. //  ppCompilationErrors
  164. //      Returns a buffer containing any error messages which occurred during
  165. //      compile.  Or NULL if you do not care about the error messages.
  166. //
  167. //----------------------------------------------------------------------------
  168.  
  169. HRESULT WINAPI
  170.     D3DXCreateEffectFromFileA(
  171.         LPDIRECT3DDEVICE8 pDevice,
  172.         LPCSTR            pSrcFile,
  173.         LPD3DXEFFECT*     ppEffect,
  174.         LPD3DXBUFFER*     ppCompilationErrors);
  175.  
  176. HRESULT WINAPI
  177.     D3DXCreateEffectFromFileW(
  178.         LPDIRECT3DDEVICE8 pDevice,
  179.         LPCWSTR           pSrcFile,
  180.         LPD3DXEFFECT*     ppEffect,
  181.         LPD3DXBUFFER*     ppCompilationErrors);
  182.  
  183. #ifdef UNICODE
  184. #define D3DXCreateEffectFromFile D3DXCreateEffectFromFileW
  185. #else
  186. #define D3DXCreateEffectFromFile D3DXCreateEffectFromFileA
  187. #endif
  188.  
  189.  
  190. HRESULT WINAPI
  191.     D3DXCreateEffectFromResourceA(
  192.         LPDIRECT3DDEVICE8 pDevice,
  193.         HMODULE           hSrcModule,
  194.         LPCSTR            pSrcResource,
  195.         LPD3DXEFFECT*     ppEffect,
  196.         LPD3DXBUFFER*     ppCompilationErrors);
  197.  
  198. HRESULT WINAPI
  199.     D3DXCreateEffectFromResourceW(
  200.         LPDIRECT3DDEVICE8 pDevice,
  201.         HMODULE           hSrcModule,
  202.         LPCWSTR           pSrcResource,
  203.         LPD3DXEFFECT*     ppEffect,
  204.         LPD3DXBUFFER*     ppCompilationErrors);
  205.  
  206. #ifdef UNICODE
  207. #define D3DXCreateEffectFromResource D3DXCreateEffectFromResourceW
  208. #else
  209. #define D3DXCreateEffectFromResource D3DXCreateEffectFromResourceA
  210. #endif
  211.  
  212.  
  213. HRESULT WINAPI
  214.     D3DXCreateEffect(
  215.         LPDIRECT3DDEVICE8 pDevice,
  216.         LPCVOID           pSrcData,
  217.         UINT              SrcDataSize,
  218.         LPD3DXEFFECT*     ppEffect,
  219.         LPD3DXBUFFER*     ppCompilationErrors);
  220.  
  221.  
  222. #ifdef __cplusplus
  223. }
  224. #endif //__cplusplus
  225.  
  226. #endif //__D3DX8EFFECT_H__
  227.